//
//  SafeAreaHelper.m
//  LuckyTools
//
//  Created by ZhàoYǒng on 2018/9/25.
//  Copyright © 2018年 ZhàoYǒng. All rights reserved.
//

#import "SafeAreaHelper.h"

//4   SCREEN_HEIGHTL = 480.000000,SCREEN_WIDTHL = 320.000000  1.5
//5   SCREEN_HEIGHTL = 568.000000,SCREEN_WIDTHL = 320.000000  1.775
//6   SCREEN_HEIGHTL = 667.000000,SCREEN_WIDTHL = 375.000000  1.7786666666
//6p  SCREEN_HEIGHTL = 736.000000,SCREEN_WIDTHL = 414.000000  1.7777777777
//XS  SCREEN_HEIGHTL = 812.000000,SCREEN_WIDTHL = 375.000000  2.1653333333
//XR  SCREEN_HEIGHTL = 896.000000,SCREEN_WIDTHL = 414.000000  2.1642512077 (2x)
//XSM SCREEN_HEIGHTL = 896.000000,SCREEN_WIDTHL = 414.000000  2.1642512077

@implementation SafeAreaHelper

BOOL LKTIsAllScreen(void) {
    CGFloat rate = UIScreen.mainScreen.bounds.size.height / UIScreen.mainScreen.bounds.size.width;
    return rate > 2.f;
}

UIEdgeInsets LKTSafeAreaInset(UIView *view) {
    if (@available(iOS 11.0, *)) {
        return view.safeAreaInsets;
    }
    return UIEdgeInsetsZero;
}

CGFloat LKTSafeAreaTop() {
    CGFloat rate = UIScreen.mainScreen.bounds.size.height / UIScreen.mainScreen.bounds.size.width;
    if (rate > 2.f) {
        return 24.f;
    }
    return 0.f;
}

CGFloat LKTSafeAreaBottom() {
    CGFloat rate = UIScreen.mainScreen.bounds.size.height / UIScreen.mainScreen.bounds.size.width;
    if (rate > 2.f) {
        return 34.f;
    }
    return 0.f;
}

CGFloat LKTTopHeight() {
    return LKTSafeAreaTop() + 64.f;
}

CGFloat LKTBottomHeight() {
    return LKTSafeAreaBottom() + 49.f;
}

@end
